package edu.ccut.saturn.authority.core.dept;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.component.SaturnData;

public class SaturnDataNullToString extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {

		SaturnData saturnData = (SaturnData) parameterContext.getParameterValue(0);
		saturnDataNullToString(saturnData);
		parameterContext.setParameter(0, saturnData);
	}

	@SuppressWarnings("unused")
	private void saturnDataNullToString(SaturnData saturnData) {

		if (saturnData != null) {
			for (String key : saturnData.keySet()) {
				if (saturnData.get(key) == null) {
					saturnData.put(key, "");
				}
			}
		}
	}
}